/*
 * 
 * Proj. Wireless - UFRN
 * 
 */

package metodologia;

import gui.JFMStep;
import gui.JFData;
import edu.uci.ics.jung.graph.DirectedSparseGraph;
import gui.JFPStep;
import java.io.Serializable;

public class TestNode implements Serializable {

    /**
     * id: 0...n, n=start+end+node;
     * catId: 0-start; 0-end; 1...n, n=node;
     * type: 0-start; 1-end; 2-node;
     */
    private int id, type, catid; // good coding practice would have this as private
    private DirectedSparseGraph<ToDoNode, String> g;
    private double X,Y;
    private JFMStep toDoScreen;
    private JFData janelaDeDados;
    private int state;
    private String nome, descricao;

    public TestNode(int id, int type, int catid) {
        this.id = id;
        this.type = type;
        this.catid = catid;
        g = new DirectedSparseGraph<ToDoNode, String>();
        toDoScreen = new JFMStep(this);
        janelaDeDados = new JFData(this);
        state = 0;
        nome = "";
        descricao = "";
    }
    
    public TestNode(int id, int type, int catid, DirectedSparseGraph<ToDoNode, String> g1) {
        this.id = id;
        this.type = type;
        this.catid = catid;
        g = g1;
        toDoScreen = new JFMStep(this);
        janelaDeDados = new JFData(this);
        state = 0;
        nome = "";
        descricao = "";
    }

    @Override
    public String toString() { // Always a good idea for debuging
        switch (this.type) {
            case 0:
                return "Inicio";
            case 2:
                return getNome();
            case 1:
                return "Final";
        }
        return "Erro";       // JUNG2 makes good use of these.
    }


    public int getType() {
        return this.type;
    }

    public int getCatid() {
        return this.catid;
    }

    public int getId() {
        return this.id;
    }

    public double getX() {
        return X;
    }

    public void setX(double X) {
        this.X = X;
    }

    public double getY() {
        return Y;
    }

    public void setY(double Y) {
        this.Y = Y;
    }

    public DirectedSparseGraph<ToDoNode, String> getG() {
        return g;
    }

    public void setG(DirectedSparseGraph<ToDoNode, String> g) {
        this.g = g;
    }

    public JFMStep getToDoScreen() {
        return toDoScreen;
    }

    public void setTodoscreen(JFMStep toDoScreen) {
        this.toDoScreen = toDoScreen;
    }

    public JFData getJFData() {
        return janelaDeDados;
    }

    public void setJFData(JFData janelaDeDados) {
        this.janelaDeDados = janelaDeDados;
        setNome(janelaDeDados.getNome());
        setDescricao(janelaDeDados.getDescricao());
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    /**
     * @return the nome
     */
    public String getNome() {
        return nome;
    }

    /**
     * @param nome the nome to set
     */
    public void setNome(String nome) {
        this.nome = nome;
    }

    /**
     * @return the descricao
     */
    public String getDescricao() {
        return descricao;
    }

    /**
     * @param descricao the descricao to set
     */
    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }
    
}
